<template>
  <div
    class="fc"
    @click="downloadFn"
  >
    <el-icon>
      <download />
    </el-icon>
    <el-button
      :type="type"
      :size="size || 'small'"
    >
      {{ btnText || 'download' }}
    </el-button>
  </div>
</template>
<script lang='ts' setup>
import { getPdf } from '@/utils/pdf'

interface Props {
  targetId: string
  name?: string
  type?: string
  btnText?: string
  size?: string
}

const props = defineProps<Props>()
const downloadFn = () => {
  const el = (window as any).document.querySelector(`#${props.targetId}`)
  getPdf(el, props.name || 'myPdf')
}
</script>
<style lang='scss' scoped>
</style>
